Skip to content

Fix psalm errors #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2023
Merged

Fix psalm errors #1209

merged 1 commit into from
Dec 18, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Dec 18, 2023

This fixes a couple of errors that appeared due to a psalm update which updated the PHPC method signatures.

@alcaeus alcaeus requested a review from GromNaN December 18, 2023 07:35
@alcaeus alcaeus self-assigned this Dec 18, 2023
Comment on lines +117 to +126
<LessSpecificReturnStatement>
<code><![CDATA[(object) $this->getArrayCopy()]]></code>
</LessSpecificReturnStatement>
<MixedAssignment>
<code>$this[$key]</code>
<code>$value</code>
</MixedAssignment>
<MoreSpecificReturnType>
<code>stdClass</code>
</MoreSpecificReturnType>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LessSpecificReturnStatement and MoreSpecificReturnType are due to vimeo/psalm#8187. In essence, Psalm takes the return value of (object) [] to be object, even though it is stdClass.

Comment on lines +518 to +520
<MixedArgument>
<code><![CDATA[$options['codec'] ?? null]]></code>
</MixedArgument>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this errors in that one specific file - it works in all other files where we have the same checks on the codec option and then use it in a typed context 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't reproduce.
https://psalm.dev/r/609a35bce9

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should set a stronger constraint on the psalm version, since there is no compose.lock.

@alcaeus
Copy link
Member Author

alcaeus commented Dec 18, 2023

Perhaps we should set a stronger constraint on the psalm version, since there is no compose.lock.

Yes, perhaps paired with dependabot updating the version constraint range when an update was released. I'll give it some thought.

@alcaeus alcaeus merged commit dc74549 into mongodb:v1.17 Dec 18, 2023
@alcaeus alcaeus deleted the fix-psalm-errors branch December 18, 2023 09:11
alcaeus added a commit that referenced this pull request Dec 18, 2023
* v1.17:
  Fix psalm errors (#1209)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants